<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>旅游首页</title>
    <link rel="stylesheet" href="../../css/amazeui.min.css">
    <link rel="stylesheet" href="css/app.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>


<div id='header' class="am-g am-topbar-fixed-top" style="padding:0 0;background:#ffaa43;height:auto;">
	<div  onclick="api.closeWin();"  class="am-u-sm-2" style="margin-top:12px;padding-left: 17px">
		<img  src="images/arr-l.png" style="height:14px;height: 18px;"/>
	</div> 
	<div class="am-u-sm-8 til" style="margin-top:13px;text-align:center;">
		<h1 id="title"></h1>
	</div>
	<div class="am-u-sm-2" style="font-size: 20px;margin-top:10px;color:white;text-align:center;">

   </div>
   
</div>

<!--<div class="am-g" style="margin-top: 46px;" id="img">-->
	<!--<img src="images/visa/02.jpg" />-->
<!--</div>-->

<div class="am-g" style="margin-top: 46px;padding: 10px;" id="list">
	<!--<div class="jindu ti">
	    <div class="title2">
	    	<div onclick="openWin('qianzhengcl')">
	    		个人旅游签证
	    	</div>           
	    	<span>￥1999</span>
	    </div>
	    <div class="title3">
	    	有效期：6个月     
	    	<span>￥180</span>
	    </div>
	    <div class="title">
	    	停留期：30天
	    </div>
	</div>-->
</div>


</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
	var list = [];
	var country;

	apiready = function(){
		country = api.pageParam.country;
//		$api.html($api.byId('img'), '<img style="width:100%;" src="' + serviceUrl + country.img + '" />');
		
		$api.html($api.byId('title'), country);
		loadData();
	};
	
	function loadData(){
		api.showProgress({
			title: '加载中...',
			modal: false
		});
		
		do_ajax('/app/visa/product?country=' + country, 'get', {}, function(ret,err){
			api.hideProgress(); 
			if(ret){
		    	list = ret.data;
		    	showlist();
		    }
		});
	}
	
	function showlist(){
		var aHtml = "";

		if(list.length > 0){
			
			for(var i = 0; i < list.length; i++){
				var product = list[i];
				
				aHtml += '<div class="jindu ti" onclick="enterDetail('+ i + ')">';
				    aHtml += '<div class="title2">';
				    	aHtml += '<div>';
				    		aHtml += product.name;
				    	aHtml += '</div>';
				    	aHtml += '<span>￥' + product.marketprice + '</span>';
				    aHtml += '</div>';
				    aHtml += '<div class="title3">';
				    	aHtml += '有效期：' + product.validdate;
				    	aHtml += '<span>￥' + product.price + '</span>';
				    aHtml += '</div>';
				    aHtml += '<div class="title">';
				    	aHtml += '停留期：' + product.staydate;
				    aHtml += '</div>';
				aHtml += '</div>';
			}
		}else{
	       aHtml += '<div class="am-u-sm-12" style="margin-top:10px;text-align:center">暂无数据...</div>'
	    }
		
		$api.html($api.byId('list'), aHtml);
	}
	
	function enterDetail(index){
		var product = list[index];
		
		openWin('qianzhengcl', {'product':product});
	}
	
</script>
</html>